package gold.digger;

import gold.utils.InputUtil;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC935 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        int mod = 1000000007;

        public int knightDialer(int n) {
            if (n == 1) return 10;
            long a = 1, b = 4, c = 2, d = 2;
            for (int i = 1; i < n; i++) {
                long bn = (2 * c + 2 * d) % mod;
                long cn = (2 * a + b) % mod;
                a = c;
                d = b;
                b = bn;
                c = cn;
            }
            return (int) ((a + b + c + d) % mod);
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.knightDialer(2));
    }

    public static void main(String[] args) throws Exception {
        LC935 an = new LC935();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
